from ConfigParser import SafeConfigParser
from Util import *
import pwd

class Configurable:
    
    def __init__(self, conf):
        self.config = SafeConfigParser()
        self.config_file = conf
        self.config.read(self.config_file)

        #passwd_file = read_as_string("/etc/passwd")
        self.user = pwd.getpwuid(os.getuid())[0]
        self.user_home = get_user_home(self.user)
        self.user_testcloud_home = self.get_user_testcloud_dir(self.user)
        self.shared_vdi_dir = self.config.get("testcloud","shared_vdi_dir")
        self.compression_extension = self.config.get("testcloud", "compression_extension")
        self.vdis_url = self.config.get("testcloud","vdis_url")

    def get_user_testcloud_dir(self, user):
        user_home = get_user_home(user)
        return os.path.join(user_home,".testcloud")



    

#configurable = Configurable("./testcloud.cfg")
#print configurable.config.get("testcloud","daemon")